//
// Created by Win on 2015/11/24.
//

#ifndef __DCOM_COMM_H_
#define __DCOM_COMM_H_

#include "frreport_comm.h"
#include "frbyte_buffer.h"


/*! dcom 私有信息储存 */
typedef struct __L7session_dcom_private
{
	Frbyte_Packet *p_st_data;            // 数据内容

	char arr_session_id[APM_UUID_SIZE];
//	struct timeval st_login_timestamp;
//	char *p_user_name;

	int i_flag_report;
	int i_use_request;
	int i_data_len;
	int i_packet_type;

	int i_packet_endian;
	int i_charset;
	int i_call_id;

	unsigned long ul_seq;
	L4_transaction st_l4_trans;

	Frlist_header *p_lst_comm_tmp;                          //数据  activeMQ comm
	Frlist_header *p_lst_req_tmp;                          //数据  activeMQ req

	Frreport_body_data *p_st_body_data_req;
	Frreport_body_data *p_st_body_data_resp;
}L7session_dcom_private;

/* 2位大头节序转到本地字节序 */
#define pntohs(p)  ((unsigned int)*((const unsigned char *)(p + 0)) << 8 | \
                    (unsigned int)*((const unsigned char *)(p + 1)) << 0)

/* 2位小头节序转到本地字节序 */
#define phtons(p)  ((unsigned int)*((const unsigned char *)(p + 0)) << 0 | \
                    (unsigned int)*((const unsigned char *)(p + 1)) << 8)
int dcom_ctx_guid(Frbyte_Packet *p_st_data, L7session_dcom_private *p_st_private, char **pp_out, int i_flag_need);

int dcom_parse(Frbyte_Packet *p_st_data, L7session_dcom_private *p_st_private, Frreport_body_data *p_st_body_data, int i_flag_need);



#endif
